<template>
  <div>
    <introduce>
      <span class="title-gray" slot="pre">安全/</span>
      <span class="title-bold" slot="title">添加密钥</span>
      <span slot="info"> - 可以添加一个API访问密钥。</span>
    </introduce>
    <el-card class="card">
      <el-form :model="addForm">
        <el-form-item label="标签" style="padding-left: 27px">
          <el-input v-model="addForm.security"></el-input>
        </el-form-item>
        <el-form-item label="访问权限">
          <el-input v-model="addForm.username"> </el-input>
        </el-form-item>
        <el-form-item label="密钥状态">
          <el-select v-model="addForm.type">
            <el-option :value="false" label="未使用"></el-option>
            <el-option :value="true" label="使用中"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item style="padding-left: 69px">
          <el-button type="primary" size="mini" @click="addItem"
            >确认</el-button
          >
          <el-button size="mini">取消</el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>

<script>
import Introduce from "@/components/Introduce.vue";
import { $securityAdd } from "@/api/index";
export default {
  name: "addSecurity",
  components: { Introduce },
  data() {
    return {
      addForm: {
        security: "",
        username: "",
        type: false,
      },
    };
  },
  methods: {
    addItem() {
      $securityAdd(this.addForm).then((res) => {
        console.log(res);
      });
    },
  },
};
</script>

<style lang="less" scoped>
.card {
  margin-top: 10px;
  .el-input {
    width: 20%;
  }
}
</style>
